package com.googlecode.flealancemarket.core.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ApplicationContextProviderSingleton implements
		ApplicationContextProvider {

	private static ApplicationContext context;

	public ApplicationContext createContext() {
		AbstractApplicationContext _context = new ClassPathXmlApplicationContext("com/googlecode/flealancemarket/core/spring/config.xml");
		_context.registerShutdownHook();
		return _context;
	}

	public ApplicationContext getContext() {
		if (context == null)
			context = createContext();
		return context;
	}
}
